package Clases;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
<<<<<<< .mine
import java.util.ArrayList;
import java.util.Collections;
=======
import java.util.ArrayList;
>>>>>>> .r22

class Buffer{
	public static void main(String [] args) throws IOException{
		File archivo = new File("C:/workspace2/Acelerometro/prueba_final3.txt");
		//File archivo = new File("/home/bonzjame/prueba_sd.txt");
		FileReader fr = new FileReader(archivo);
		BufferedReader br = new BufferedReader(fr);
		Function f = new Function();
		float x, y, z, time;
		String linea = null;
		String [] split;
		ArrayList<Float> _x = new ArrayList<Float>();
		ArrayList<Float> _y = new ArrayList<Float>();
		ArrayList<Float> _z = new ArrayList<Float>();
		while((linea = br.readLine()) != null){
			split = linea.split(",");
			x = Float.parseFloat(split[0]);
			y = Float.parseFloat(split[1]);
			z = Float.parseFloat(split[2]);
			time = Float.parseFloat(split[3]);
			f.operar(x, y, z, time);
			_x.add(x);
			_y.add(y);
			_z.add(z);
//			System.out.print(z+" ");
//			f.operar(x, 0, 0, 0);
//			if(f.completa()){
//				System.out.println(f.getAceleracionX().toString());
//				f.inicializar();
//			}
			//System.out.println("X: "+x+", Y: "+y+", Z: "+z+", Time: "+time);
		}	
		System.out.println("Ax n: "+_x.toString());
		System.out.println("Ay n: "+_y.toString());
		System.out.println("Az n: "+_z.toString());
		fr.close();
<<<<<<< .mine
		System.out.println("Medida: "+f.calculoEspacio());
		System.out.println("Entrada X: "+f.getEX());
		System.out.println("Entrada Y: "+f.getEY());
		System.out.println("Entrada Z: "+f.getEZ());
		System.out.println("==========================================================");
		System.out.println("Calibrado X: "+f.getCX());
		System.out.println("Calibrado Y: "+f.getCY());
		System.out.println("Calibrado Z: "+f.getCZ());
		System.out.println("==========================================================");
		System.out.println("Filtrado X: "+f.getAceleracionX());
		System.out.println("Filtrado Y: "+f.getAceleracionY());
		System.out.println("Filtrado Z: "+f.getAceleracionZ());
		System.out.println("==========================================================");
		System.out.println("Velocidad Y"+ f.getVelocidadY());
		System.out.println("Espacio Y"+ f.getEspacioY());
		System.out.println("==========================================================");

		
		ArrayList<Float>ax=f.getEX();
		ArrayList<Float>ay=f.getEY();
		ArrayList<Float>az=f.getEZ();
		ArrayList<Float>cax=f.getCX();
		ArrayList<Float>cay=f.getCY();
		ArrayList<Float>caz=f.getCZ();
		ArrayList<Float>fax=f.getAceleracionX();
		ArrayList<Float>fay=f.getAceleracionY();
		ArrayList<Float>faz=f.getAceleracionZ();
		Collections.reverse(ax);
		Collections.reverse(ay);
		Collections.reverse(az);
		Collections.reverse(cax);
		Collections.reverse(cay);
		Collections.reverse(caz);
		Collections.reverse(fax);
		Collections.reverse(fay);
		Collections.reverse(faz);
		
		System.out.println("Entrada X: "+ax);
		System.out.println("Entrada Y: "+ay);
		System.out.println("Entrada Z: "+az);
		System.out.println("==========================================================");
		System.out.println("Calibrado X: "+cax);
		System.out.println("Calibrado Y: "+cay);
		System.out.println("Calibrado Z: "+caz);
		System.out.println("==========================================================");
		System.out.println("Filtrado X: "+fax);
		System.out.println("Filtrado Y: "+fay);
		System.out.println("Filtrado Z: "+faz);

=======
		System.out.println("Ax: "+f.getAceleracionX().toString());
		System.out.println("Ay: "+f.getAceleracionY().toString());
		System.out.println("Az: "+f.getAceleracionZ().toString());
		System.out.println("Vx: "+f.getVelocidadX().toString());
>>>>>>> .r22
		System.out.println("Vy: "+f.getVelocidadY().toString());
		System.out.println("Vz: "+f.getVelocidadZ().toString());
		System.out.println("Ex: "+f.getEspacioX().toString());
		System.out.println("Ey: "+f.getEspacioY().toString());
		System.out.println("Ez: "+f.getEspacioZ().toString());
	}
}